package com.huxin.servelt.admin;

import com.alibaba.fastjson.JSON;
import com.huxin.pojo.BookTypeInfo;
import com.huxin.pojo.ProblemFeedback;
import com.huxin.service.Userservice;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * 查询所有问题
 */
@WebServlet("/admin/getAllProblem")
public class GetAllProblemServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Userservice userservice = new Userservice();
        List<ProblemFeedback> problemFeedbackList=userservice.getAllProblem();
        String jsonString = JSON.toJSONString(problemFeedbackList);
        System.out.println(jsonString);
        response.getWriter().write(jsonString);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
